﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;

namespace FirstHomeWork.Utility.Extend
{
    public static class YouWhereExtend
    {
        public static IEnumerable<T> YouWhere<T>(this IEnumerable<T> t, Func<T, bool> func) where T : class
        {
            List<T> resultList = null;

            if (t != null)
            {
                resultList = new List<T>();

                foreach (var item in t)
                {
                    if (func.Invoke(item))
                    {
                        resultList.Add(item);
                    }
                }
            }
            return resultList;
        }
    }
}
